
%{
#include "openvip_third/nutshell_cachewrapper.h"
#include "openvip_third/nutshell_simplebus.h"
#include "openvip_third/nutshell_simpleram.h"
#include "openvip_third/nutshell_simpleuart.h"
#include "openvip_third/xs_coupledl2.h"
#include "openvip/ovip.h"
#include "openvip/tilelink.h"
#include "openvip/axi4_async.h"
#include "openvip/axi4.h"
#include "openvip/mem.h"
%}

%apply unsigned long long {u_int64_t}
%apply unsigned int {u_uint32_t}
%apply unsigned short {u_uint16_t}
%apply unsigned char {u_uint8_t}

%apply unsigned long long {uint64_t}
%apply unsigned int {uint32_t}
%apply unsigned short {uint16_t}
%apply unsigned char {uint8_t}

%apply long long {i_int64_t}
%apply int {i_int32_t}
%apply short {i_int16_t}
%apply char {i_int8_t}

%apply long long {int64_t}
%apply int {int32_t}
%apply short {int16_t}
%apply char {int8_t}

%include std_string.i
%include std_map.i
%include std_vector.i

%ignore ovip::TLMasterPortCor;

%include "openvip/ovip.h"
namespace ovip {
    std::string version();
}

%include "openvip/tilelink.h"
%include "openvip/axi4_async.h"
%include "openvip/axi4.h"
%include "openvip/mem.h"
%include "openvip/ovip.h"

%include "openvip_third/nutshell_cachewrapper.h"
%include "openvip_third/nutshell_simplebus.h"
%include "openvip_third/nutshell_simpleram.h"
%include "openvip_third/nutshell_simpleuart.h"
%include "openvip_third/xs_coupledl2.h"

%feature("director") xfunction;

// callbacks constraints:
// (1) use d_callback define cb before %include "xspcomm/xcallback.h"
// (2) use x_callback define cb after %include "xspcomm/xcallback.h"

%define %d_callback(Name, Ret, T...)
%feature("director") xfunction<Ret,T>;
%ignore xfunction<Ret,T>::operator bool;
%ignore xfunction<Ret,T>::operator();
%enddef

%define %x_callback(Name, Ret, T...)
%template(Name) xfunction<Ret,T>;
%enddef

// d_callback defines
// tilelink tl_cb
%d_callback(tilelink_tl_cb, bool, ovip::TLPort *master, ovip::TLData *data_or_req, ovip::TLData *resp, void *args)

// Note: need include callback after director
%include "xspcomm/xcallback.h"

// x_callback defines
// tilelink tl_cb
%x_callback(tilelink_tl_cb, bool, ovip::TLPort *master, ovip::TLData *data_or_req, ovip::TLData *resp, void *args)
